"""
用户 VO
"""

from models import (
    VOBase,
    VOPage,
)
from utils.data_utils.special import ObjectIdStr
from utils.mock_utils import Demo
from utils.validator_utils.pydantic_validator.field import (
    CharField,
    NormalField,
)


class UserAuthenticatedVO(VOBase):
    """ 用户 | 认证成功的数据 | VO """

    user_id: ObjectIdStr = CharField(..., title="用户 ID（ObjectId 字符串）", examples=[Demo.id])

    avatar_url: str = CharField(..., title="头像 URL")
    nickname: str = CharField(..., title="昵称", min_length=3, max_length=20)
    token: str = CharField(..., title="Token")
    username: str = CharField(..., title="用户名", min_length=3, max_length=20)


class UserCheckVO(VOBase):
    """ 用户 | 检查 | VO """

    exist: bool = NormalField(..., title="用户是否存在")


class UserListVO(VOBase):
    """ 用户 | 列表 | VO """

    user_id: ObjectIdStr = CharField(..., title="用户 ID（ObjectId 字符串）", examples=[Demo.id])

    avatar_url: str = CharField(..., title="头像 URL")
    nickname: str = CharField(..., title="昵称", min_length=3, max_length=20)


class UserDetailVO(UserListVO):
    """ 用户 | 详情 | VO """

    last_active: str = CharField(..., title="上次活跃时间", min_length=19, max_length=19, examples=[Demo.dt_str])
    join_date: str = CharField(..., title="加入时间", min_length=10, max_length=10, examples=[Demo.date_str])


class UserListPage(VOPage[UserListVO]):
    """ 用户 | 列表 | 分页 """
